package at.codebase.web.util.i18n;

/**
 * Wrapper class for a single Language. Based on the ISO 639-2 language codes.
 * You can find a list here: http://www.loc.gov/standards/iso639-2/php/English_list.php
 * 
 * @author Lukas Pfeifhofer <lukas.pfeifhofer@devlabs.pro>
 *
 */
public class I18NLocale {
	
	private String lang;
	
	public I18NLocale(String language){
		this.lang = language;
	}
	
	public String getLocale(){
		return this.lang;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((lang == null) ? 0 : lang.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		I18NLocale other = (I18NLocale) obj;
		if (lang == null) {
			if (other.lang != null)
				return false;
		} else if (!lang.equals(other.lang))
			return false;
		return true;
	}

}
